<?php

/**
 * Well Framework
 * 
 * Layout helper abscract class
 * contain abstract method help()
 * 
 * @todo extends one base class at LayoutHelper & Command classes
 * 
 * @package    Well
 * @subpackage 
 * 
 * @author Valeriy Lazarevych <valeriy.fremar@gmail.com>
 * @copyright Fremar ltd.
 */

abstract class LayoutHelper
{
    /**
     * Placeholder for helper view object
     * @var View
     */
    protected $view; 
    
    /**
     * Contain app inbox request
     * @var Request $request 
     */
    protected $request;
    
    /**
     * Contain user session data
     * @var Session $sesion 
     */
    protected $session;
    
    
    /**
     * Initialize helper view
     *  
     * @todo use late static binding to instanceate the view obj
     * 
     * @param type $class_name string
     */
    public function __construct($class_name)
    {
        // Create helper view
        $this->view     =   new View( strtolower($class_name) );
        
        // Set helpers views dir location
        $this->view->setViewsPath( 'layouts/helpers/views/' );
        
        // Get app request
        $this->request  =   ApplicationRegistry::get('request');
        
        // Get user session data
        $this->session  =   ApplicationRegistry::get('session');
    }
    
    /**
     * Call helper action & then render own view     
     */
    public function help()
    {    
        $this->actionHelp();
        
        $this->view->render();        
    }
    
    abstract protected function actionHelp();        
}
?>
